package com.hp.service;

import com.hp.entity.User;
import com.hp.dao.UserDao;
import com.hp.entity.dto.UserDto;
import com.hp.utils.Page;

import java.util.List;
import java.util.Map;

public class UserService {
    private UserDao userDao=new UserDao();
    public UserDto login(String account)  {
        UserDto dto=userDao.getUser(account);
        return dto;
    }

    public Page getUserListByPage(Map<String, Object> map) {
        Page<UserDto> page=new Page<>();
        List<UserDto> list= userDao.getUserListByPage(map);
        Long total=userDao.totalUser(map);
        page.setTotal(total);
        page.setList(list);
        return page;
    }

    public boolean addUser(User user) {
        return userDao.addUser(user);
    }

    public List<User> getDocterList(String sign, String departmentId) {
        return userDao.getDocterList(sign,departmentId);
    }
    /**
     * 功能1：重载getDocterList方法，用于分页查询的条件。
     * @param departmentId
     * @return
     */
    public List<User> getDocterList(String departmentId) {
        return userDao.getDocterList(departmentId);
    }

    public boolean editUserInfo(User user) {
        return userDao.editUserInfo(user);
    }

    public boolean updateUserHeadUrl(String headUrl, String id) {
        return userDao.updateUserHeadUrl(headUrl,id);
    }
}
